#Jaroslav Crhonek (crhonjar@fit.cvut.cz)

def oddElements(i)
  mojePole = []
  i.each_with_index do |x,j|
    if !j.odd?
      mojePole << x
      if block_given?
        yield(x)
      end
    end
  end
  mojePole
end

puts ">> Start"
puts "original field:"
pole = [ 1 , 3 , 5 , 7 , 9 , 11, 13 ]
puts pole
puts "oddElements without block:"
puts oddElements( pole )
puts "oddElements with block:"
oddElements( pole ) do | a |
  puts "#{a*a}"
end

puts "<< Stop"